package com.heart.house.common.page;

import lombok.Data;

import java.util.List;

/**
 * @author Luo Zhen
 * @create 2019-06-24 14:47
 */
@Data
public class PageData<T> {

    private List<T> list;

    private Pagination pagination;

    public PageData(Pagination pagination, List<T> list) {
        this.pagination = pagination;
        this.list = list;
    }

    public static <T> PageData<T> buildPage(List<T> list, long count, Integer pageSize, Integer pageNum) {
        Pagination pagination = new Pagination(pageSize, pageNum, count);
        return new PageData<>(pagination, list);
    }
}
